<template>
  <div class="content-week">
    <div class="week-btn">
      <el-button type="primary" size="small" @click="commitBoard(4)">预览</el-button>
      <el-button type="primary" size="small" plain="" @click="commitBoard(0)">暂存</el-button>
      <el-button type="primary" size="small" @click="commitBoard(1)">提交</el-button>
    </div>
    <div class="week-con">
      <div class="left_top_tabs" v-if="formCode === 'FORM_V3'">
        <span :class="{ tabs_active: showTabs === '1' }" @click="tabsCli('1')">单框模式填写</span>
        <span :class="{ tabs_active: showTabs === '2' }" @click="tabsCli('2')">条目化模式填写</span>
      </div>
      <div v-show="showTabs == '1'">
        <div class="title_main_one">
          <span class="top_require">*</span>
          本周工作纪实
          <span class="title_time">({{ formContent.startDate }}-{{ formContent.endDate }})</span>
        </div>
        <el-input
          placeholder="请在输入框输入您的工作纪实"
          type="textarea"
          v-model="formContent.workCon"
          size="small"
          :autosize="{ minRows: 10, maxRows: 10000 }"></el-input>
        <div class="title_main_one">下周工作计划</div>
        <el-input
          class="m-b-1"
          placeholder="请输入您的工作计划"
          type="textarea"
          v-model="formContent.planCon"
          size="small"
          :autosize="{ minRows: 10, maxRows: 10000 }"></el-input>
      </div>
      <div v-show="showTabs == '2'">
        <div class="week_top_title">
          <div class="title_main_one">
            <span class="top_require">*</span>
            本周工作纪实
            <span class="title_time">({{ formContent.startDate }}-{{ formContent.endDate }})</span>
          </div>
          <div class="top_title_r">
            <span @click="operateCli">
              <i class="el-icon-menu"></i>
              示例&操作
            </span>
          </div>
        </div>
        <el-form :model="dailyObj" ref="ruleFormNow" class="m-b-1">
          <el-table
            :data="dailyObj.nowWeekList"
            border
            stripe
            style="width: 100%"
            size="mini"
            header-row-class-name="table_col">
            <el-table-column type="index" label="" align="center" width="30"></el-table-column>
            <el-table-column prop="workContent" label="*工作内容" align="center" min-width="220">
              <template slot-scope="scope">
                <el-form-item
                  :prop="'nowWeekList.' + scope.$index + '.workContent'"
                  :rules="dailyObj.nowWeekRules.workContent">
                  <el-input
                    class="font_input"
                    resize="none"
                    :ref="`enterInput${scope.$index}`"
                    type="textarea"
                    :autosize="{ minRows: 3, maxRows: 10000 }"
                    size="small"
                    :placeholder="
                      scope.$index == 0
                        ? `示例：每日登录“学习强国”平台平台进行理论学习，本周获得XX学分`
                        : scope.$index == 1
                        ? `示例：教育窗口处理现场咨询`
                        : ''
                    "
                    v-model="scope.row.workContent"
                    clearable></el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column prop="workTag" label="工作分类" align="center" width="150">
              <template slot-scope="scope">
                <el-form-item>
                  <el-select
                    v-model="scope.row.workTag"
                    value-key="code"
                    placeholder="请选择或填写"
                    filterable
                    clearable
                    size="small"
                    @change.native="selectBlur($event, scope.$index, '1')"
                    @blur.native="selectBlur($event, scope.$index, '1')">
                    <el-option
                      v-for="item in classifyList"
                      :key="item.code"
                      :label="item.name"
                      :value="item.name"></el-option>
                  </el-select>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column prop="finishStatus" label="完成情况" align="center" width="100">
              <template slot-scope="scope">
                <div class="week_comlpete">
                  <span
                    @click="
                      scope.row.finishStatus == '1' ? (scope.row.finishStatus = '0') : (scope.row.finishStatus = '1')
                    ">
                    <i
                      :class="[
                        scope.row.finishStatus == '1' ? 'el-icon-success' : 'el-icon-time',
                        scope.row.finishStatus == '1' ? 'color_success' : 'color_primary',
                      ]"></i>
                    {{ scope.row.finishStatus == '1' ? '已完成' : '进行中' }}
                  </span>
                </div>
              </template>
            </el-table-column>
            <el-table-column prop="workClassify" label="所属类型" align="center" width="120">
              <template slot-scope="scope">
                <el-form-item>
                  <el-select v-model="scope.row.workClassify" value-key="code" placeholder="请选择" size="small">
                    <el-option
                      v-for="item in taskList"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"></el-option>
                  </el-select>
                </el-form-item>
              </template>

              <template slot="header">
                <div class="table_tips">
                  所属类型
                  <el-tooltip class="item" effect="dark" placement="top">
                    <div slot="content" class="content_tips">{{ TABLE_HEADER_TIPS }}</div>
                    <i class="el-icon-warning-outline" :style="{ color: 'red' }"></i>
                  </el-tooltip>
                </div>
              </template>
            </el-table-column>
            <el-table-column prop="czpt" label="操作" align="center" width="130">
              <template slot-scope="scope">
                <div class="icon_opetate">
                  <i
                    title="添加"
                    class="blue-font el-icon-circle-plus-outline"
                    @click="addRowsWeek(scope.row, scope.$index)"></i>
                  <i
                    title="从模板中添加"
                    class="blue-font m-l-10 el-icon-tickets"
                    @click="addRowsTemplate(scope.row, scope.$index)"></i>
                  <i
                    title="收藏"
                    class="blue-font m-l-10 el-icon-star-off"
                    @click="collectWeek(scope.row, scope.$index)"></i>
                  <i
                    title="删除"
                    v-if="dailyObj.nowWeekList.length > 1"
                    class="red-font m-l-10 el-icon-delete"
                    @click="cancelWeek(scope.$index)"></i>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-form>
        <div class="title_main_one">下周工作计划</div>
        <el-form :model="dailyObj" ref="ruleFormNext" class="m-b-1">
          <el-table
            :data="dailyObj.nextWeekList"
            border
            stripe
            style="width: 100%"
            size="mini"
            header-row-class-name="table_col">
            <el-table-column type="index" label="" align="center" width="30"></el-table-column>
            <el-table-column prop="workContent" label="*工作内容" align="center">
              <template slot-scope="scope">
                <el-form-item
                  :prop="'nextWeekList.' + scope.$index + '.workContent'"
                  :rules="dailyObj.moduleListRules.workContent">
                  <el-input
                    type="textarea"
                    :autosize="{ minRows: 2, maxRows: 10000 }"
                    :placeholder="
                      scope.$index == 0
                        ? `示例：每日登录“学习强国”平台平台进行理论学习`
                        : scope.$index == 1
                        ? `示例：教育窗口处理现场咨询`
                        : ''
                    "
                    v-model="scope.row.workContent"
                    clearable
                    size="small"
                    class="font_input"
                    resize="none"
                    :ref="`enterPlanInput${scope.$index}`"></el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column prop="workTag" label="工作分类" align="center" width="160">
              <template slot-scope="scope">
                <el-form-item
                  :prop="'nextWeekList.' + scope.$index + '.workTag'"
                  :rules="dailyObj.moduleListRules.workTag">
                  <el-select
                    v-model="scope.row.workTag"
                    value-key="code"
                    placeholder="请选择或填写"
                    filterable
                    clearable
                    size="small"
                    @change.native="selectBlur($event, scope.$index, '2')"
                    @blur.native="selectBlur($event, scope.$index, '2')">
                    <el-option
                      v-for="item in classifyList"
                      :key="item.code"
                      :label="item.name"
                      :value="item.name"></el-option>
                  </el-select>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column prop="workClassify" label="所属类型" align="center" width="150">
              <template slot-scope="scope">
                <el-form-item>
                  <el-select v-model="scope.row.workClassify" value-key="code" placeholder="请选择" size="small">
                    <el-option
                      v-for="item in taskList"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"></el-option>
                  </el-select>
                </el-form-item>
              </template>
              <template slot="header">
                <div class="table_tips">
                  所属类型
                  <el-tooltip class="item" effect="dark" placement="top">
                    <div slot="content" class="content_tips">{{ TABLE_HEADER_TIPS }}</div>
                    <i class="el-icon-warning-outline" :style="{ color: 'red' }"></i>
                  </el-tooltip>
                </div>
              </template>
            </el-table-column>
            <el-table-column prop="czpt" label="操作" align="center" width="130">
              <template slot-scope="scope">
                <div class="icon_opetate">
                  <i
                    title="添加"
                    class="blue-font el-icon-circle-plus-outline"
                    @click="addNextWeek(scope.row, scope.$index)"></i>
                  <i
                    title="从模板中添加"
                    class="blue-font m-l-10 el-icon-tickets"
                    @click="addNextTemplate(scope.row, scope.$index)"></i>
                  <i
                    title="收藏"
                    class="blue-font m-l-10 el-icon-star-off"
                    @click="collectNextWeek(scope.row, scope.$index)"></i>
                  <i
                    title="删除"
                    v-if="dailyObj.nextWeekList.length > 1"
                    class="red-font m-l-10 el-icon-delete"
                    @click="cancelNextWeek(scope.$index)"></i>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-form>
      </div>
      <div class="week_left_title">
        <p class="title_main_suggest">问题建议</p>
        <div v-if="suggestList.length == 1">
          <span @click="addSuggestRows" class="el-icon-plus szsy_box_add_btn">添 加</span>
        </div>
      </div>
      <div class="szsy_box">
        <div class="szsy_box_add" v-for="(item, index) in suggestList" :key="index">
          <div class="arrract_one_main">
            <div class="szsy_box_add_title">
              <div>
                <span class="szsy_box_add_index" v-if="suggestList.length > 1">{{ index + 1 }}</span>
              </div>
              <div>
                <span
                  v-if="suggestList.length > 1 && index == suggestList.length - 1"
                  @click="addSuggestRows"
                  class="el-icon-plus szsy_box_add_btn">
                  添 加
                </span>
                <span
                  v-if="suggestList.length > 1"
                  @click="delSuggestRow(index)"
                  class="el-icon-delete szsy_box_add_btdel">
                  删除
                </span>
              </div>
            </div>
            <el-input
              type="textarea"
              class="font_input"
              placeholder="若无此项内容，则不用填写；如有多条内容，可点击“添加”，逐条新增。"
              v-model="item.proCon"
              :autosize="{ minRows: 5, maxRows: 10000 }"
              maxlength="300"
              show-word-limit></el-input>
          </div>
          <div class="mar_upload">
            <UploadFile :file-list="item.proFileList" />
          </div>
        </div>
      </div>

      <div class="title_main_one">添加图片/附件</div>
      <div class="board_list_file">
        <UploadFile :file-list="formContent.recordFileList" />
      </div>
    </div>

    <!-- 模板 start -->
    <XnDialog
      custom-class="branch_dialog"
      title="从模板中添加"
      :visible.sync="templateShow"
      @close="templateShow = false">
      <TemplateAdd
        :noteId="$route.query.id"
        @templateBtn="templateBtn"
        @cancelTemplate="templateShow = false"
        v-if="templateShow" />
    </XnDialog>

    <!-- 收藏成功提醒 start -->
    <XnDialog custom-class="collect_dialog" title="提示" :visible.sync="collectShow" @close="collectShow = false">
      <div>
        <i class="color_warning_dia el-icon-warning"></i>
        成功收藏至个人模板，点击“从模板添加”即可快速复用收藏的内容
      </div>
      <div class="bot_tips">
        <el-checkbox v-model="checkedCollect">不再提醒</el-checkbox>
        <!-- <span class="bot_tips_btn" @click="btnCheck">好的</span> -->
        <el-button type="primary" @click="btnCheck" size="small">好 的</el-button>
      </div>
    </XnDialog>

    <!-- 收藏成功提醒 end -->

    <!-- 示例与操作 start -->
    <XnDialog
      custom-class="branch_dialog"
      title="示例与操作"
      :visible.sync="operationsShow"
      @close="operationsShow = false"
      width="1200px">
      <img style="width: 1150px" src="../../../assets/images/document/boardTips.png" alt="" />
    </XnDialog>

    <!-- 示例与操作 end -->

    <!-- 提交的提醒 start -->
    <XnDialog
      custom-class="collect_dialog"
      title="提示"
      :visible.sync="tipsObj.submitShow"
      @close="tipsObj.submitShow = false"
      width="500px">
      <div>
        <i class="color_warning_dia el-icon-warning"></i>
        {{ tipsObj.submitTips }}
      </div>
      <div class="sunmit_tips">
        <el-button @click="tipsObj.submitShow = false" size="small">取消</el-button>
        <el-button type="primary" @click="saveData(tipsObj.saveStatusDia)" size="small">确 定</el-button>
      </div>
    </XnDialog>
  </div>
</template>

<script>
import {
  queryCodeInfo,
  selectUserRememberTips,
  queryRoleCodeInfo,
  collectNoteTemplateInfo,
  checkSubmitRecord,
  addRecordNoteWeek,
} from '@apis/board.js'
import TemplateAdd from './components/TemplateAdd'
import UploadFile from '@com/UploadFile'
import XnDialog from '@com/xnDialog.vue'
export default {
  name: 'WriteContentWeek',
  components: { TemplateAdd, UploadFile, XnDialog },
  props: {
    info: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    const validName = (rule, value, callback) => {
      if (Object.keys(value).length === 0) {
        callback(new Error('必填项'))
      } else {
        callback()
      }
    }
    return {
      showTabs: '1',
      taskList: [], // 所属类型
      classifyList: [], // 工作分类
      formData: {
        isPublic: '',
        recordName: '',
        recordId: '',
        formCode: '',
        showStartTime: '',
        showEndTime: '',
      },
      dailyObj: {
        nowWeekList: [
          { workContent: '', workTag: '', finishStatus: '1', finishPercent: '', workClassify: '' },
          { workContent: '', workTag: '', finishStatus: '1', finishPercent: '', workClassify: '' },
        ],
        nowWeekRules: {
          workContent: [{ required: true, validator: validName, trigger: 'blur' }],
        },
        nextWeekList: [
          { workContent: '', workTag: '', workClassify: '' },
          { workContent: '', workTag: '', workClassify: '' },
        ],
        moduleListRules: {
          workContent: [{ required: true, validator: validName, trigger: 'blur' }],
        },
      },

      suggestList: [], // 问题建议

      numersShow: false, // 切换条目化
      numersCheck: false,

      collectShow: false, // 收藏
      checkedCollect: false,

      templateShow: false, // 模板展示
      operationsShow: false, // 示例与操作

      selectIndex: 0, // 选中的单元格
      selectType: '',

      // 路由参数
      routerQuery: {},
      // 是否是提交，用于判断退出时 destroyed函数中是否调用暂存
      isCommit: false,
      TABLE_HEADER_TIPS:
        '日常任务一般是指岗位职责运行需完成的任务，如行政审批类任务；重点任务是组织绩效计划所确定的年度重点工作，如改革创新类任务；专项任务是指临时性、突发性任务，往往有急难险重的特征，如抗疫、抗洪、绩效试点任务。',
      tipsDisShow: false,
      mesTips: '',
      // 提交提示
      tipsObj: {
        submitShow: false,
        submitTips: '',
        saveStatusDia: '',
      },

      formCode: '', // 表单类型：FORM_V1单框，条目化，单框&条目化
      formContent: {
        recordFileList: [],
      },
    }
  },
  watch: {
    info: {
      handler(news) {
        if (news.recordId) {
          this.initData()
        }
      },
    },
  },
  computed: {},
  created() {
    this.routerQuery = this.$route.query
  },
  mounted() {
    if (this.info.recordId) {
      this.initData()
    }
  },
  methods: {
    initData() {
      const data = this.info
      this.formData = data
      this.formCode = data.formCode
      if (this.formCode === 'FORM_V1' || this.formCode === 'FORM_V3') {
        this.formContent = data.formV1VO
        // 问题建议
        this.suggestList = data.formV1VO.proConList || []
        if (this.suggestList.length === 0) {
          this.suggestList = [
            {
              proCon: '',
              proFileList: [],
              proAudioList: [],
              id: '',
            },
          ]
        }
      }
      if (this.formCode === 'FORM_V2' || this.formCode === 'FORM_V3') {
        this.getCodeInfo()
        if (this.formCode === 'FORM_V2') {
          this.formContent = data.formV2VO
        }
        // 问题建议
        this.suggestList = data.formV2VO.proConList || []
        if (this.suggestList.length === 0) {
          this.suggestList = [
            {
              proCon: '',
              proFileList: [],
              proAudioList: [],
              id: '',
            },
          ]
        }
        this.dailyObj.nowWeekList = data.formV2VO.workConList // 条目化本周
        this.dailyObj.nextWeekList = data.formV2VO.planConList // 条目化下周
        if (this.dailyObj.nowWeekList.length === 0) {
          this.dailyObj.nowWeekList = [
            {
              workContent: '',
              workTag: '',
              finishStatus: '1',
              finishPercent: '',
              workClassify: '',
              workClassifyName: '',
              linkId: '',
              id: '',
              audioList: [],
            },
          ]
        }
        if (this.dailyObj.nextWeekList.length === 0) {
          this.dailyObj.nextWeekList = [
            {
              workContent: '',
              workTag: '',
              workClassify: '',
              workClassifyName: '',
              linkId: '',
              id: '',
              finishStatus: '',
              finishPercent: '',
              audioList: [],
            },
          ]
        }
      }
      this.$nextTick(() => {
        this.showTabs = this.formCode === 'FORM_V2' ? '2' : '1'
      })
    },
    operateCli() {
      this.operationsShow = true
    },
    // 获取枚举
    getCodeInfo() {
      queryCodeInfo({
        oneParam: 'NOTE_WORK_CLASSIFY',
      }).then(res => {
        this.taskList = res.data
      })
      queryRoleCodeInfo({
        oneParam: 'NOTE_WORK_TAG',
      }).then(res => {
        this.classifyList = res.data
      })
    },
    // 意见建议
    addSuggestRows() {
      this.suggestList.push({
        proCon: '',
        proFileList: [],
        proAudioList: [],
        id: '',
      })
    },
    // 删除意见
    delSuggestRow(index) {
      this.suggestList.splice(index, 1)
      this.commitBoard(2)
    },

    selectBlur(e, index, types) {
      if (types === '1') {
        this.dailyObj.nowWeekList[index].workTag = e.target.value
      } else if (types === '2') {
        this.dailyObj.nextWeekList[index].workTag = e.target.value
      }
    },

    // 模板添加-本周
    addRowsTemplate(row, index) {
      this.commitBoard(3)
      this.templateShow = true
      this.selectIndex = index
      this.selectType = '1'
    },

    // 添加一行-本周工作计划
    addRowsWeek(row, index) {
      this.commitBoard(3)
      const workObject = {
        workContent: '',
        workTag: '',
        finishStatus: '1',
        finishPercent: '',
        workClassify: '',
        workClassifyName: '',
        linkId: '',
        id: '',
        audioList: [],
      }
      this.dailyObj.nowWeekList.splice(index + 1, 0, workObject)
    },
    // 删除-本周
    cancelWeek(index) {
      this.dailyObj.nowWeekList.splice(index, 1)
      this.commitBoard(3)
    },

    // 收藏
    collectWeek(item, index) {
      const validate = this.validateField('ruleFormNow', index)
      if (validate) {
        this.collectOne(item)
      } else {
        return false
      }
    },
    // 收藏
    collectOne(item) {
      const oneCollect = Object.assign(item, { templateType: '1' })
      collectNoteTemplateInfo(oneCollect).then(res => {
        if (res.code === 0) {
          // 获取展示弹框
          selectUserRememberTips({
            recordType: 'NOTE_REL_CONTENT_TEMPLATE_COLLECT',
          }).then(res => {
            if (res.code === 0) {
              this.collectShow = res.data === 1
              if (!this.collectShow) {
                this.$message.success('收藏成功')
              }
            }
          })
        }
      })
    },
    // 收藏成功
    btnCheck() {
      if (this.checkedCollect) {
        this.showNo('NOTE_REL_CONTENT_TEMPLATE_COLLECT')
      }
      this.collectShow = false
    },

    // 从模板中添加 - 下周
    addNextTemplate(row, index) {
      this.commitBoard(3)
      this.selectIndex = index
      this.selectType = '2'
      this.templateShow = true
    },

    // 模板中添加-确认
    templateBtn(chooseTable) {
      this.templateShow = false
      if (chooseTable.length > 0) {
        for (const i in chooseTable) {
          const oneChoose = chooseTable[i]
          if (this.selectType === '1') {
            this.dailyObj.nowWeekList.splice(this.selectIndex + Number(i) + 1, 0, oneChoose)
          } else if (this.selectType === '2') {
            this.dailyObj.nextWeekList.splice(this.selectIndex + Number(i) + 1, 0, oneChoose)
          }
        }
      }
    },

    // 添加一行-下周工作计划
    addNextWeek(row, index) {
      this.commitBoard(3)
      this.dailyObj.nextWeekList.splice(index + 1, 0, {
        workContent: '',
        workTag: '',
        workClassify: '',
        workClassifyName: '',
        linkId: '',
        id: '',
        finishStatus: '',
        finishPercent: '',
        audioList: [],
      })
    },

    // 删除 - 下周
    cancelNextWeek(index) {
      this.dailyObj.nextWeekList.splice(index, 1)
      this.commitBoard(3)
    },

    // 收藏-下周
    collectNextWeek(row, index) {
      const validate = this.validateField('ruleFormNext', index)
      if (validate) {
        this.collectOne(row)
      } else {
        return false
      }
    },

    // 对部分表单字段进行校验
    validateField(form, index) {
      let result = true
      for (const item of this.$refs[form].fields) {
        if (item.prop.split('.')[1] === index.toString()) {
          this.$refs[form].validateField(item.prop, error => {
            if (error !== '') {
              result = false
            }
          })
        }
        if (!result) break
      }
      return result
    },
    tabsCli(chooseTab) {
      this.showTabs = chooseTab
    },
    commitBoard(saveStatus) {
      if (saveStatus === 1) {
        checkSubmitRecord({
          id: this.routerQuery.id,
        }).then(res => {
          if (res.code === 0) {
            if (!res.data.flag) {
              this.$confirm(res.data.tips, '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
              })
                .then(() => {})
                .catch(() => {})
            } else {
              this.dataCheck(saveStatus)
            }
          }
        })
      } else {
        this.saveData(saveStatus)
      }
    },
    saveData(saveStatus) {
      // 提交还是暂存1：提交   0：暂存
      const status = saveStatus === 1 ? saveStatus : 0
      const params = { ...this.formData }
      if (['FORM_V1', 'FORM_V3'].includes(this.formCode)) {
        params.formV1VO = this.formContent
        params.formV1VO.proConList = this.suggestList.filter(item => {
          return item.proCon.trim().length || item.proFileList.length
        })
      }
      if (['FORM_V2', 'FORM_V3'].includes(this.formCode)) {
        if (this.formCode === 'FORM_V2') {
          params.formV2VO = this.formContent
        }
        params.formV2VO.proConList = this.suggestList.filter(item => {
          return item.proCon.trim().length || item.proFileList.length
        })
        params.formV2VO.workConList = this.dailyObj.nowWeekList
        params.formV2VO.planConList = this.dailyObj.nextWeekList
        params.formV2VO.recordFileList = this.formContent.recordFileList
      }
      addRecordNoteWeek({
        ...params,
        saveStatus: status,
      }).then(res => {
        if (res.code === 0) {
          /**
           * saveStatus：
           * 0:暂存
           * 1:提交
           * 2:只暂存意见建议不暂存纪实
           * 3:只暂存不显示暂存成功提示
           * 4:预览
           */
          if (saveStatus === 1) {
            this.$message({
              message: '提交成功',
              type: 'success',
            })
            this.isRouterShwitch = true
            this.tipsObj.submitShow = false
            this.isCommit = true
            setTimeout(() => {
              this.$router.go(-1)
            }, 1000)
          } else if (saveStatus === 0) {
            this.$message({
              message: '暂存成功',
              type: 'success',
            })
          } else if (saveStatus === 4) {
            this.isCommit = true
            this.$router.push({
              path: '/document/index-detail',
              query: { id: this.routerQuery.id, recordType: this.routerQuery.recordType },
            })
          }
        }
      })
    },
    dataCheck(saveStatus) {
      if (saveStatus === 1) {
        for (const i in this.suggestList) {
          if (this.suggestList[i].proCon && this.suggestList[i].proCon.trim().length <= 5) {
            this.$message({
              message: '问题建议必须大于5个字！',
              type: 'warning',
            })
            return false
          }
        }
        const nowWeekList = this.dailyObj.nowWeekList.filter(item => {
          return item.workContent
        })
        if (nowWeekList.length === 0 && this.formContent.workCon.trim() === '') {
          this.$message({
            message: '请填写周纪实！',
            type: 'warning',
          })
          return false
        } else if (
          nowWeekList.length === 0 &&
          this.formContent.workCon &&
          this.formContent.workCon.trim().length < 10
        ) {
          this.$message({
            message: '工作纪实必须大于10个字！',
            type: 'warning',
          })
          return false
        }
      }
      if (saveStatus === 1) {
        this.tipsObj.submitShow = true
        this.tipsObj.submitTips = '提交后周纪实内容不可修改，您确定要提交吗？'
        this.tipsObj.saveStatusDia = saveStatus
      } else {
        this.saveData(saveStatus)
      }
    },
  },
}
</script>
<style lang="scss" scoped>
.content_tips {
  width: 320px;
  line-height: 22px;
}
.content-week {
  width: 100%;
  height: 100%;
  .week-btn {
    position: absolute;
    right: -380px;
    top: -60px;
  }
  .week-con {
    padding: 10px 20px;
    height: calc(100% - 5px);
    overflow-y: auto;
    .left_top_tabs {
      display: flex;
      justify-content: center;
      align-items: center;
      span {
        display: inline-block;
        height: 40px;
        padding: 0 20px;
        border: 1px solid #ececec;
        border-radius: 2px;
        text-align: center;
        line-height: 40px;
        cursor: pointer;
        font-size: 16px;
        &:not(:last-of-type) {
          border-right: 0;
        }
      }
      .tabs_active {
        background-color: #0060c4;
        border-color: #0060c4;
        color: #ffffff;
      }
    }
    .szsy_box_add_btn {
      font-size: 14px;
      color: #4b79bb;
      margin-right: 10px;
      cursor: pointer;
    }
    .el-table {
      border-left: 1px solid #ececec;
      font-size: 14px;
      .week_comlpete {
        cursor: pointer;
      }
      .color_success {
        color: #67c23a;
      }
      .color_primary {
        color: #409eff;
      }
      .icon_opetate {
        font-size: 16px;
      }
    }
    .week_top_title {
      display: flex;
      justify-content: space-between;
      .top_title_r {
        font-size: 16px;
        color: #4b79bb;
        > span {
          margin-right: 10px;
          cursor: pointer;
        }
      }
    }
    .week_left_title {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .title_main_suggest {
      font-size: 16px;
      font-weight: bold;
    }
    .title_main_one {
      font-size: 16px;
      font-weight: bold;
      margin-bottom: 10px;
      margin-top: 10px;
      .top_require {
        color: #ff0000;
      }
      .title_time {
        font-weight: 400;
        font-size: 14px;
      }
    }
    .board_list_file {
      padding-left: 10px;
      margin-bottom: 30px;
    }
    /deep/.font_input {
      font-size: 14px;
      &::-webkit-scrollbar {
        width: 0px;
        height: 0px;
        border-radius: 0px;
      }
    }
    .szsy_box {
      .szsy_box_add {
        padding: 10px 0;
      }
      .arrract_one_main {
        border: 1px solid #dddddd;
        /deep/.el-textarea__inner {
          border: none;
        }
        .szsy_box_add_title {
          display: flex;
          flex-direction: row;
          justify-content: space-between;
          padding: 10px;
        }
        .szsy_box_add_index {
          display: inline-block;
          height: 30px;
          line-height: 30px;
          width: 20px;
          border: 1px solid #dddddd;
          text-align: center;
          color: #4b79bb;
          font-size: 16px;
          font-weight: 600;
        }
      }
      .szsy_box_add_btdel {
        color: #f56c6c;
        margin-right: 10px;
        cursor: pointer;
      }
      .mar_upload {
        border: 1px solid #dcdfe6;
        padding: 10px;
        border-top: 0;
      }
    }
  }
}
.collect_dialog {
  display: flex;
  align-items: center;
  font-size: 18px;
  padding-left: 20px;
  color: #333;
  .bot_tips {
    border-top: 1px solid #ececec;
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
  }
  .bot_tips_btn {
    cursor: pointer;
    color: #1852a3;
    font-size: 16px;
  }
  .color_warning_dia {
    color: #e6a23c;
    font-size: 18px;
    margin-right: 5px;
  }
  .sunmit_tips {
    margin-top: 15px;
    text-align: right;
  }
}
</style>
